class BaseEntity<T> {
  String code;
  String error;
  String message;
  T data;

  BaseEntity({this.code, this.error, this.message, this.data});

  BaseEntity.fromJson(Map<String, dynamic> json) {
    this.code = json["code"]?.toString() ?? '0';
    this.error = json["error"]?.toString() ?? '0';
    this.message = json["message"] ?? '';
  }

  bool isSuccess() {
    return error == '0';
  }
}
